home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / knowhow4 / editl.h < prev    next >
C/C++ Source or Header  |  1994-10-10  |  2KB  |  59 lines

  1. /*  EDITL.H    One-line-editor. After exiting keeps its string in
  2.     global[global_num], where global_num is the number of this line
  3.     in container.
  4. */
  5.  
  6. #ifndef __EDIT_LINE_H_
  7. #define __EDIT_LINE_H_
  8.  
  9. #include <alloc.h>
  10. #include <string.h>
  11.  
  12. #include "formline.h"
  13. #include "output.h"
  14. #include "visible.h"
  15.  
  16. #define MAX_LEN 80    // maximum visible len, total max is 255
  17.  
  18. class EditLine : public FormLine, public Visible
  19.     {
  20.     protected:
  21.     char* string;         // string to edit, default ""
  22.     int ins;              // insert flag
  23.     int outkey;           // char to draw
  24.     loc xy;               // left - top
  25.     int len;              // length
  26.     int maxlen;           // maximum length
  27.     int pattern;              // Pattern number, PATTERN.*
  28.     public:
  29.     EditLine(loc pos, int l, int max_len = 0,
  30.         BORDERS b_type = BUTTON_BORDER, int pat = 0, int insert = 1);
  31.  
  32.     virtual ~EditLine() { delete string; }
  33.     virtual void repose(rect new_coord);
  34.     virtual void exe(int act = 0);
  35.     virtual void show()   {  FormLine::show(xy, len, string, pattern); }
  36.     virtual rect bound();
  37.     void put_string(char* str);
  38.     char* get_string() { return string; }
  39.     void draw_char(int* cur_pos, int* vis_pos);
  40.     void left(int* cur_pos, int* vis_pos);
  41.     void right(int* cur_pos, int* vis_pos);
  42.     void home(int* cur_pos, int* vis_pos);
  43.     void del(int* cur_pos, int* vis_pos);
  44.     void bksp(int* cur_pos, int *vis_pos);
  45.     void end(int* cur_pos, int* vis_pos);
  46.  
  47.     void redraw_string(loc pos, int tmp, int start = 0);
  48.     void insert(int* cur_pos);
  49.  
  50.     void hilite();
  51.     void unhilite();
  52.     };
  53.  
  54.  
  55.  
  56. #endif __EDIT_LINE_H_
  57.  
  58.  
  59.